using MediatR;
using System.ComponentModel.DataAnnotations;
using TaskProject.ErrorCode;
using TaskProject.Extension.Plan;

namespace TaskProject.Application.Command.Plan
{
    /// <summary>
    /// 更新生产计划命令
    /// </summary>
    public class UpdateProductionPlanCommand : IRequest<APIResult<bool>>
    {
        /// <summary>
        /// 生产计划ID
        /// </summary>
        public int PlanId { get; set; }

        /// <summary>
        /// 计划主题
        /// </summary>
        [Required(ErrorMessage = "计划主题不能为空")]
        [MaxLength(200, ErrorMessage = "计划主题长度不能超过200个字符")]
        public string PlanSubject { get; set; }

        /// <summary>
        /// 计划单号
        /// </summary>
        [Required(ErrorMessage = "计划单号不能为空")]
        [MaxLength(50, ErrorMessage = "计划单号长度不能超过50个字符")]
        public string PlanOrderNumber { get; set; }

        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime? DocumentDate { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(500, ErrorMessage = "备注长度不能超过500个字符")]
        public string? Remarks { get; set; }

        /// <summary>
        /// 销售订单号（可选）
        /// </summary>
        [MaxLength(50, ErrorMessage = "销售订单号长度不能超过50个字符")]
        public string? SalesOrderNumber { get; set; }

        /// <summary>
        /// 关联项目名称
        /// </summary>
        [MaxLength(100, ErrorMessage = "关联项目名称长度不能超过100个字符")]
        public string? RelatedProjectName { get; set; }

        /// <summary>
        /// 计划状态（0-草稿，1-已确认，2-执行中，3-已完成，4-已取消）
        /// </summary>
        public int PlanStatus { get; set; }

        /// <summary>
        /// 预计开始日期
        /// </summary>
        public DateTime? ExpectedStartDate { get; set; }

        /// <summary>
        /// 预计完成日期
        /// </summary>
        public DateTime? ExpectedEndDate { get; set; }

        /// <summary>
        /// 生产线
        /// </summary>
        [MaxLength(100, ErrorMessage = "生产线长度不能超过100个字符")]
        public string? ProductionLine { get; set; }

        /// <summary>
        /// 优先级（1-低，2-中，3-高，4-紧急）
        /// </summary>
        public int Priority { get; set; }

        /// <summary>
        /// 生产物品列表
        /// </summary>
        public List<ProductionPlanItemDTO> ProductionItems { get; set; } = new List<ProductionPlanItemDTO>();

        /// <summary>
        /// 附件列表
        /// </summary>
        public List<ProductionPlanAttachmentDTO> Attachments { get; set; } = new List<ProductionPlanAttachmentDTO>();
    }
} 